package com.ss.android.article.base.feature.feed.c;

import android.content.Context;
import android.text.TextUtils;

import com.ss.android.article.base.feature.model.FeedCallAppAd;
import com.ss.android.common.ad.MobAdClickCombiner;
import com.ss.android.common.download.DownloadShortInfo;

import org.json.JSONObject;

public final class FeedDownloadAppAd extends FeedCallAppAd {
    public String type;
    public String buttonText;
    public String source;
    public int uiType;

    public FeedDownloadAppAd() {
        super(1);
    }

    public final void initWithJO(JSONObject jo) {
        super.initWithJO(jo);
        if (jo != null) {
            try {
                this.type = jo.optString("type");
                this.buttonText = jo.optString("button_text");
                if ("action".equals(this.type)) {
                    jo.optString("display_info");
                    this.actionType = 1;
                }
                this.source = jo.optString("source");
                this.uiType = jo.optInt("ui_type", 0);
            } catch (Exception exception) {
            }
        }
    }

    public final boolean a(Context context) {
        boolean v0 = super.a(context);
        if (v0) {
            try {
                JSONObject jo = new JSONObject();
                if (!android.support.design.a.isTextEmpty(this.logExtra)) {
                    jo.put("log_extra", this.logExtra);
                }
                MobAdClickCombiner.onAdEvent(context, "feed_download_ad", "hide", this.id, 0, jo, 2);
            } catch (Exception exception) {
            }
        }

        return v0;
    }

    public final void a(Context context,
                        String arg4,
                        String arg5,
                        long arg6,
                        long arg8,
                        JSONObject arg10,
                        int arg11) {
        if (arg11 != 6) {
            super.a(context, arg4, arg5, arg6, arg8, arg10, arg11);
        }
    }

    public final void a(DownloadShortInfo downloadInfo,
                        Context context,
                        String arg13,
                        long arg14,
                        long arg16,
                        JSONObject jo,
                        int arg19) {
        String v2;
        if (TextUtils.isEmpty(arg13)) {
            switch (arg19) {
                case 6: {
                    v2 = "detail_download_ad";
                    break;
                }
                case 7: {
                    v2 = "feed_download_ad";
                    break;
                }
                default:
                    v2 = arg13;
            }
        } else {
            v2 = arg13;
        }

        switch (downloadInfo.b) {
            case 1:
            case 2: {
                MobAdClickCombiner.onAdEvent(context, v2, "click_pause", arg14, arg16, jo, this.p);
                break;
            }
            case 4: {
                MobAdClickCombiner.onAdEvent(context, v2, "click_continue", arg14, arg16, jo, this.p);
                break;
            }
        }
    }
}

